package com.example.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;


/**
 * @application:
 * @author: LiYuhang
 * @Date: 2021/5/25 22:56
 * @version: 0.1
 * @Description :
 * @Modified By:
 */
@Component
@Slf4j
public class ListenerMessage2 implements StreamListener<String, MapRecord<String, String, String>> {

    @Autowired
    private RedisTemplate redisTemplate;


    /**
     * 收到消息，不主动ack
     * @param entries
     */
    @Override
    public void onMessage(MapRecord<String, String, String> entries) {
        log.info("ListenerMessage2  接收到来自redis的消息 此消息不ACK:{}",entries);
    }

}
